<template>
	<view class="container">
		<u-swiper :list="banners" height="330rpx" circular indicator
			:indicatorStyle="{'text-align': 'center', 'bottom': '20rpx'}" @click="handleClickSwiper">
		</u-swiper>
		<view class="ptb_8 minh_100">
			<u-sticky offsetTop="0">
				<view class="tabs_wrap">
					<u-tabs :current="currentType" :list="cateList" keyName="typeName" lineColor="#F93914"
						itemStyle="font-size:28rpx;padding: 20rpx 16rpx;background: #fff; " activeStyle="color: #F93914"
						inactiveStyle="color: #000000" lineWidth="32rpx" lineHeight="6rpx"
						@change="handleGoodsType"></u-tabs>
				</view>
			</u-sticky>
			<view class="br_8 fx fx_w jcb plr_12">
				<GoodsCard type="rush-card" :data="item" v-for="item,index in dataList" :key="index" goodsType="4" />
			</view>
			<view class="ptb_16">
				<u-loadmore :status="loadingStatus" />
			</view>
		</view>
	</view>
</template>

<script>
	import GoodsCard from '@/components/goods/GoodsCard.vue'
	import dataMixin from '@/mixins/data.js'
	import bannerMixin from '@/mixins/banner.js'
	import cateMixin from '@/mixins/cate.js'
	import {
		mapState
	} from 'vuex'
	export default {
		mixins: [dataMixin, bannerMixin, cateMixin],
		components: {
			GoodsCard
		},
		data() {
			return {
				dataInfo: {
					banner: []
				},
				dataList: [],
				listUrl: '/goods/api/product/scrambleProductList',
				params: {
					userType: this.$store.state.userInfo.identityType || 1,
					functionRange: this.$store.state.functionRange
				},
				bannerId: 4, // banner位置
				noHideLoading: true,
			}
		},
		onLoad() {
			this.getCateList()
		},
		onShow() {
			this.getAllData()
		},
		methods: {
			getAllData() {
				this.$utils.loading()
				Promise.all([this.getBannerData(), this.getData(true)]).then(() => {
					uni.hideLoading()
				})
			},
		},
	}
</script>